/*
 * @Description: 客户标签管理
 * @Author: zhaolei
 * @Date: 2023-07-05 14:56:40
 */

import request from '@/router/axios';

// 新增标签类型
export function addObj(data) {
  return request({
    url: '/app/appuser/label',
    method: 'post',
    data,
  });
}

// 编辑标签类型
export function putObj(data) {
  return request({
    url: '/app/appuser/label',
    method: 'put',
    data,
  });
}

// 获取标签类型详情
export function getObj(id) {
  return request({
    url: `/app/appuser/label/${id}`,
    method: 'get',
  });
}

// 删除标签类型
export function delObj(id) {
  return request({
    url: `/app/appuser/label/${id}`,
    method: 'delete',
  });
}

// 获取所有一级标签类型
export function fetchList(params) {
  return request({
    url: '/app/appuser/label/typeList',
    method: 'get',
    params,
  });
}

// 获取所有二级标签类型
export function fetchSecondList(params) {
  return request({
    url: '/app/appuser/label/list',
    method: 'get',
    params,
  });
}

// 获取所有二级标签的标签用户
export function fetchLabelUserList(params) {
  return request({
    url: '/app/appuser/label/contact/page',
    method: 'get',
    params,
  });
}

// 获取所有标签
export function fetchAllLabeList() {
  return request({
    url: '/app/appuser/label/list/all',
    method: 'get',
  });
}
//获取运营人员 - 用户标签
export function fetchUserLabel(userId) {
  return request({
    url: `/app/appuser/label/list/${userId}`,
    method: 'get',
  });
}
//查询
export function fetchLabelList(params) {
  return request({
    url: '/app/appuser/label/page',
    method: 'get',
    params,
  });
}

// 保存标签
export function saveTag(obj) {
  return request({
    url: '/app/appuser/label/contact',
    method: 'post',
    data: obj,
  });
}
